package com.xcity.db.entity;

import java.util.Date;
import java.util.List;

import com.xcity.game.achievement.AchievementManager;
import com.xcity.game.adventure.model.Adventure;
import com.xcity.game.assist.AssistManager;
import com.xcity.game.battle.pve.PVEManager;
import com.xcity.game.battle.res.ResStageManager;
import com.xcity.game.buff.BuffManager;
import com.xcity.game.build.BuildManager;
import com.xcity.game.buildv2.BuildManagerV2;
import com.xcity.game.conquests.Conquests;
import com.xcity.game.employee.EmployeeManager;
import com.xcity.game.equip.Equipments;
import com.xcity.game.financial.FinancialManager;
import com.xcity.game.formation.FormationManager;
import com.xcity.game.map.Mines;
import com.xcity.game.map.MineReportManager;
import com.xcity.game.peakroad.model.PeakRoadInstance;
import com.xcity.game.pet.PetManager;
import com.xcity.game.proxy.DynamicProxyInfo;
import com.xcity.game.skill.v2.SkillManagerV2;
import com.xcity.game.task.TaskManager;

import naga.x.db.type.PropertyPool;

/**
 * player表与player_ext表对应的实体类
 * @author yang.li
 *
 */
public abstract class AbstractPlayer {

	protected long id;
	protected long userId;
	protected String name;
	protected String icon;
	protected byte sex;
	protected int level;
	protected int vipLvl;
	protected long exp;
	protected long gold;
	protected int stone;
	protected long fixedAssets = -1; // 固定资产
	protected int qualityLvl; // 品级
	protected int destinyLvl; // 天命等级
	protected String sign;
	protected String province;
	protected String city;
	protected Date createTime;
	protected Date lastLoginTime;
	protected Date lastLogoutTime;
	protected int map, x, y;
	protected PropertyPool pool;
	// player_ext
	@Deprecated
	protected BuildManager buildings;
	protected BuffManager buffs;
	protected TaskManager tasks;
	protected AchievementManager achievements;
	protected FinancialManager financials;
	protected PetManager pets;
	protected EmployeeManager employees;
	protected PVEManager pveStages;
	protected Equipments equips;
	protected Conquests conquests; // 占领的建筑
	protected SkillManagerV2 skillManager;
	protected Adventure adventure; // 奇遇v2
	protected BuildManagerV2 buildings2;
//	protected float[] attributes; // 成长的战斗数值（升品、天命）
	protected PeakRoadInstance peakRoadInstance; // 爬塔副本（巅峰之路）
	protected ResStageManager resStages;//资源副本
	protected FormationManager formations; // 战斗阵型
	protected MineReportManager mineReports; // 探索(占矿)战报
	protected Mines mines; //探索 矿点员工信息
	protected AssistManager assists;//协助防守信息
	
	public static final byte MALE = 1, FEMALE = 2;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public byte getSex() {
		return sex;
	}

	public void setSex(byte sex) {
		this.sex = sex == MALE ? sex : FEMALE;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public int getVipLvl() {
		return vipLvl;
	}

	public void setVipLvl(int vipLvl) {
		this.vipLvl = vipLvl;
	}

	public long getExp() {
		return exp;
	}

	public void setExp(long exp) {
		this.exp = exp;
	}

	public long getGold() {
		return gold;
	}

	public void setGold(long gold) {
		this.gold = gold;
	}

	public int getStone() {
		return stone;
	}

	public void setStone(int stone) {
		this.stone = stone;
	}
	
	public long getFixedAssets() {
		return fixedAssets;
	}
	
	public void setFixedAssets(long fixedAssets) {
		this.fixedAssets = fixedAssets;
	}

	public int getQualityLvl() {
		return qualityLvl;
	}

	public void setQualityLvl(int qualityLvl) {
		this.qualityLvl = qualityLvl;
	}

	public int getDestinyLvl() {
		return destinyLvl;
	}

	public void setDestinyLvl(int destinyLvl) {
		this.destinyLvl = destinyLvl;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public Date getLastLogoutTime() {
		return lastLogoutTime;
	}

	public void setLastLogoutTime(Date lastLogoutTime) {
		this.lastLogoutTime = lastLogoutTime;
	}

	public int getMap() {
		return map;
	}

	public void setMap(int map) {
		this.map = map;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public PropertyPool getPool() {
		return pool;
	}

	public void setPool(PropertyPool pool) {
		this.pool = pool;
	}

	@Deprecated
	public BuildManager getBuildings() {
		return buildings;
	}

	@Deprecated
	public void setBuildings(BuildManager buildings) {
		this.buildings = buildings;
		if (buildings != null) {
			buildings.setOwner((Player) this);
		}
	}

	public BuffManager getBuffs() {
		return buffs;
	}

	public void setBuffs(BuffManager buffs) {
		this.buffs = buffs;
		if (buffs != null) {
			buffs.init((Player) this);
		}
	}

	public TaskManager getTasks() {
		return tasks;
	}

	public void setTasks(TaskManager tasks) {
		this.tasks = tasks;
		if (tasks != null) {
			tasks.init((Player) this);
		}
	}

	public AchievementManager getAchievements() {
		return achievements;
	}

	public void setAchievements(AchievementManager achievements) {
		this.achievements = achievements;
		if (achievements != null) {
			achievements.init((Player) this);
		}
	}

	public FinancialManager getFinancials() {
		return financials;
	}

	public void setFinancials(FinancialManager financials) {
		this.financials = financials;
		if (financials != null) {
			financials.init((Player) this);
		}
	}

	public PetManager getPets() {
		return pets;
	}

	public void setPets(PetManager pets) {
		this.pets = pets;
		if (pets != null) {
			pets.setOwner((Player) this);
		}
	}

	public EmployeeManager getEmployees() {
		return employees;
	}
	
	public void setEmployees(List<Employee> employees) {
		this.employees = new EmployeeManager((Player) this, employees);
	}
	
	public void setEmployeeManager(EmployeeManager em) {
		this.employees = em;
		if (em != null) {
			em.setOwner((Player) this);
		}
	}

	public PVEManager getPveStages() {
		return pveStages;
	}

	public void setPveStages(PVEManager pveStages) {
		this.pveStages = pveStages;
		if (pveStages != null) {
			pveStages.setOwner((Player) this);
		}
	}

	public Equipments getEquips() {
		return equips;
	}

	public void setEquips(Equipments equips) {
		this.equips = equips;
		if (equips != null) {
			equips.setOwner((Player) this);
		}
	}

	public Conquests getConquests() {
		return conquests;
	}

	public void setConquests(Conquests conquests) {
		this.conquests = conquests;
		if (conquests != null) {
			conquests.setOwner((Player) this);
		}
	}

	public SkillManagerV2 getSkillManager() {
		return skillManager;
	}

	public void setSkillManager(SkillManagerV2 skillManager) {
		this.skillManager = skillManager;
		if (skillManager != null) {
			skillManager.setOwner((Player) this);
		}
	}
	
	public Adventure getAdventure() {
		return adventure;
	}
	
	public void setAdventure(Adventure adventure) {
		this.adventure = adventure;
		if (adventure != null) {
			adventure.setOwner((Player) this);
		}
	}

	public BuildManagerV2 getBuildings2() {
		return buildings2;
	}

	public void setBuildings2(BuildManagerV2 buildings2) {
		this.buildings2 = buildings2;
		if (buildings2 != null) {
			buildings2.setOwner((Player) this);
		}
	}

//	public float[] getAttributes() {
//		return attributes;
//	}
//
//	public void setAttributes(float[] attributes) {
//		this.attributes = attributes;
//	}

	public PeakRoadInstance getPeakRoadInstance() {
		return peakRoadInstance;
	}

	public void setPeakRoadInstance(PeakRoadInstance peakRoadInstance) {
		this.peakRoadInstance = peakRoadInstance;
		if (peakRoadInstance != null) {
			peakRoadInstance.setOwner((Player) this);
		}
	}

	public ResStageManager getResStages() {
		return resStages;
	}

	public void setResStages(ResStageManager resStages) {
		this.resStages = resStages;
	}

	public FormationManager getFormations() {
		return formations;
	}

	public void setFormations(FormationManager formations) {
		this.formations = formations;
		if (formations != null) {
			formations.setOwner((Player) this);
		}
	}

	public MineReportManager getMineReports() {
		return mineReports;
	}

	public void setMineReports(MineReportManager mineReports) {
		this.mineReports = mineReports;
		if (mineReports != null) {
			mineReports.setOwner((Player) this);
		}
	}

	public AssistManager getAssists() {
		return assists;
	}

	public void setAssists(AssistManager assists) {
		this.assists = assists;
		if(assists != null){
			assists.setOwner((Player) this);
		}
	}

	public Mines getMines() {
		return mines;
	}

	public void setMines(Mines mines) {
		this.mines = mines;
	}
}
